<template>
  <div>
    <el-table
      :data="CarList"
      :stripe="true"
      style="width: 100%">
      <el-table-column
        prop="cid"
        label="编号">
      </el-table-column>
      <el-table-column
        prop="carNo"
        label="车牌号">
      </el-table-column>

      <el-table-column
        label="操作" width="300px">
        <template slot-scope="scope">
          <el-button @click="deleteById(scope.row.cid)"  size="mini" v-if="role==2">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <router-view/>
  </div>
</template>

<script>
  export default {
    name: "CarList",
    data(){
      return {
        CarList:[],
        uid:sessionStorage.getItem("uid"),
        role:sessionStorage.getItem("role")
      }
    },
    created(){
      this.selectAll();
    },
    methods: {

      selectAll(){
        let url=""

        url="/car/selectMycars/"+this.uid;

        this.axios.get(url).then((resp)=>{
          this.CarList=resp.data;
        });
      }
    }
  }
</script>

<style scoped>

</style>
